VERSION 1.0 CLASS
BEGIN
  MultiUse = -1  'True
  Persistable = 0  'NotPersistable
  DataBindingBehavior = 0  'vbNone
  DataSourceBehavior  = 0  'vbNone
  MTSTransactionMode  = 0  'NotAnMTSObject
END
Attribute VB_Name = "CReporte"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = True
Attribute VB_PredeclaredId = False
Attribute VB_Exposed = False
Option Explicit
Private crApp As New CRAXDRT.Application
Private crReport As New CRAXDRT.Report

Public Sub mostrarReporteDocumentos(bParms As BParametrosReporte)
 Dim i As Integer
    Set crReport = crApp.OpenReport(App.Path & "\reports\rptDocumentos.rpt", 1)
    
    For i = 1 To crReport.ParameterFields.Count
        crReport.ParameterFields(i).ClearCurrentValueAndRange
    Next
    i = 1
    crReport.ParameterFields(i).AddCurrentValue UCase(bParametro.bCompaniadPorDefecto.sRazonSocial): i = i + 1
    
    crReport.ParameterFields(i).AddCurrentValue "'" + Format(bParms.dFechaFin, bParametro.sFormatoFecha) + "'": i = i + 1
    crReport.ParameterFields(i).AddCurrentValue "'" + Format(bParms.dFechaIni, bParametro.sFormatoFecha) + "'": i = i + 1
    crReport.ParameterFields(i).AddCurrentValue "'" + bParametro.bCompaniadPorDefecto.sRuc + "'": i = i + 1
    crReport.ParameterFields(i).AddCurrentValue "'" + bParms.bPuntoVenta.sSerie + "'": i = i + 1
    
    For i = 1 To crReport.Database.Tables.Count
        crReport.Database.Tables(i).ConnectionProperties.Item("Password") = utilConexion.sClave
    Next i
    frmReport.viewer.ReportSource = crReport
    frmReport.viewer.ViewReport
    frmReport.viewer.EnableRefreshButton = False
    frmReport.viewer.EnableGroupTree = False
    frmReport.Show
End Sub

Public Sub mostrarReporteVentas(bParms As BParametrosReporte)
 Dim i As Integer
    Set crReport = crApp.OpenReport(App.Path & "\reports\rptVentas.rpt", 1)
    
    For i = 1 To crReport.ParameterFields.Count
        crReport.ParameterFields(i).ClearCurrentValueAndRange
    Next
    If Not bParms.bMostrarGrafico Then
        For i = 1 To crReport.Sections.Count
            crReport.Sections(i).Suppress = (UCase(crReport.Sections(i).Name) = UtilConstantes.RPT_SECCION_GRAFICOA)
        Next
    End If
    i = 1
    crReport.ParameterFields(i).AddCurrentValue UCase(bParametro.bCompaniadPorDefecto.sRazonSocial): i = i + 1
    crReport.ParameterFields(i).AddCurrentValue "'" + Format(bParms.dFechaFin, bParametro.sFormatoFecha) + "'": i = i + 1
    crReport.ParameterFields(i).AddCurrentValue "'" + Format(bParms.dFechaIni, bParametro.sFormatoFecha) + "'": i = i + 1
    crReport.ParameterFields(i).AddCurrentValue "'" + bParametro.bCompaniadPorDefecto.sRuc + "'": i = i + 1
    crReport.ParameterFields(i).AddCurrentValue "'" + bParms.bPuntoVenta.sSerie + "'": i = i + 1
    For i = 1 To crReport.Database.Tables.Count
        crReport.Database.Tables(i).ConnectionProperties.Item("Password") = utilConexion.sClave
    Next i
    frmReport.viewer.ReportSource = crReport
    frmReport.viewer.ViewReport
    frmReport.viewer.EnableRefreshButton = False
    frmReport.viewer.EnableGroupTree = False
    frmReport.Show
End Sub

Public Sub mostrarReporteEmpleados()
Dim i As Integer
    Set crReport = crApp.OpenReport(App.Path & "\reports\rptEmpleados.rpt", 1)
    For i = 1 To crReport.Database.Tables.Count
        crReport.Database.Tables(i).ConnectionProperties.Item("Password") = utilConexion.sClave
    Next i
    i = 1
    'crReport.ParameterFields(i).AddCurrentValue UCase(bParametro.bCompaniadPorDefecto.sRazonSocial): i = i + 1
    frmReport.viewer.ReportSource = crReport
    frmReport.viewer.ViewReport
    frmReport.viewer.EnableRefreshButton = False
    frmReport.viewer.EnableGroupTree = False
    frmReport.Show
End Sub
Public Sub mostrarReporteListaServicios()
Dim i As Integer
    Set crReport = crApp.OpenReport(App.Path & "\reports\rptProductos.rpt", 1)
    For i = 1 To crReport.Database.Tables.Count
        crReport.Database.Tables(i).ConnectionProperties.Item("Password") = utilConexion.sClave
    Next i
    i = 1
    crReport.ParameterFields(i).AddCurrentValue UCase(bParametro.bCompaniadPorDefecto.sRazonSocial): i = i + 1
    frmReport.viewer.ReportSource = crReport
    frmReport.viewer.ViewReport
    frmReport.viewer.EnableRefreshButton = False
    frmReport.viewer.EnableGroupTree = False
    frmReport.Show
End Sub


Public Sub mostrarReporteProductos(bParms As BParametrosReporte)
    Dim i As Integer
    If bParms.bMostrarDetalle Then
        Set crReport = crApp.OpenReport(App.Path & "\reports\rptVentasxProductoDetallado.rpt", 1)
    Else
        Set crReport = crApp.OpenReport(App.Path & "\reports\rptVentasxProducto.rpt", 1)
    End If
    For i = 1 To crReport.ParameterFields.Count
        crReport.ParameterFields(i).ClearCurrentValueAndRange
    Next
    If Not bParms.bMostrarGrafico Then
        For i = 1 To crReport.Sections.Count
            crReport.Sections(i).Suppress = (UCase(crReport.Sections(i).Name) = UtilConstantes.RPT_SECCION_GRAFICOA)
        Next
    End If
    i = 1
    crReport.ParameterFields(i).AddCurrentValue UCase(bParametro.bCompaniadPorDefecto.sRazonSocial): i = i + 1
    crReport.ParameterFields(i).AddCurrentValue "'" + Format(bParms.dFechaFin, bParametro.sFormatoFecha) + "'": i = i + 1
    crReport.ParameterFields(i).AddCurrentValue "'" + Format(bParms.dFechaIni, bParametro.sFormatoFecha) + "'": i = i + 1
    crReport.ParameterFields(i).AddCurrentValue "'" + bParametro.bCompaniadPorDefecto.sRuc + "'": i = i + 1
    crReport.ParameterFields(i).AddCurrentValue "'" + bParms.bPuntoVenta.sSerie + "'": i = i + 1
    For i = 1 To crReport.Database.Tables.Count
        crReport.Database.Tables(i).ConnectionProperties.Item("Password") = utilConexion.sClave
    Next i
    frmReport.viewer.ReportSource = crReport
    frmReport.viewer.ViewReport
    frmReport.viewer.EnableRefreshButton = False
    frmReport.viewer.EnableGroupTree = False
    frmReport.Show
End Sub




Public Sub mostrarReporteComandas(bParms As BParametrosReporte)
    Dim i As Integer
    Set crReport = crApp.OpenReport(App.Path & "\reports\rptComandas.rpt", 1)
    For i = 1 To crReport.ParameterFields.Count
        crReport.ParameterFields(i).ClearCurrentValueAndRange
    Next
    i = 1
    'crReport.ParameterFields(i).AddCurrentValue UCase(bParametro.bCompaniadPorDefecto.sRazonSocial): i = i + 1
    crReport.ParameterFields(i).AddCurrentValue "'" + Format(bParms.dFechaFin, bParametro.sFormatoFecha) + "'": i = i + 1
    crReport.ParameterFields(i).AddCurrentValue "'" + Format(bParms.dFechaIni, bParametro.sFormatoFecha) + "'": i = i + 1
    crReport.ParameterFields(i).AddCurrentValue "'" + bParametro.bCompaniadPorDefecto.sRuc + "'": i = i + 1
    crReport.ParameterFields(i).AddCurrentValue "'" + bParms.bPuntoVenta.sSerie + "'": i = i + 1
    For i = 1 To crReport.Database.Tables.Count
        crReport.Database.Tables(i).ConnectionProperties.Item("Password") = utilConexion.sClave
    Next i
    frmReport.viewer.ReportSource = crReport
    frmReport.viewer.ViewReport
    frmReport.viewer.EnableRefreshButton = False
    frmReport.viewer.EnableGroupTree = False
    frmReport.Show
End Sub

Public Sub mostrarReporteStock(bParms As balmacen)
    Dim i As Integer
    Set crReport = crApp.OpenReport(App.Path & "\reports\rptStockProductos.rpt", 1)
    For i = 1 To crReport.ParameterFields.Count
        crReport.ParameterFields(i).ClearCurrentValueAndRange
    Next
    i = 1
    
    crReport.ParameterFields(i).AddCurrentValue bParms.nCodigo
    
    For i = 1 To crReport.Database.Tables.Count
        crReport.Database.Tables(i).ConnectionProperties.Item("Password") = utilConexion.sClave
    Next i
    frmReport.viewer.ReportSource = crReport
    frmReport.viewer.ViewReport
    frmReport.viewer.EnableRefreshButton = False
    frmReport.viewer.EnableGroupTree = False
    frmReport.Show
End Sub


Public Sub mostrarReporteStockProductos(bParms As balmacen)
    Dim i As Integer
    Set crReport = crApp.OpenReport(App.Path & "\reports\rptStockAlmacen.rpt", 1)
    For i = 1 To crReport.ParameterFields.Count
        crReport.ParameterFields(i).ClearCurrentValueAndRange
    Next
    i = 1
    
    crReport.ParameterFields(i).AddCurrentValue bParms.nCodigo
    
    For i = 1 To crReport.Database.Tables.Count
        crReport.Database.Tables(i).ConnectionProperties.Item("Password") = utilConexion.sClave
    Next i
    frmReport.viewer.ReportSource = crReport
    frmReport.viewer.ViewReport
    frmReport.viewer.EnableRefreshButton = False
    frmReport.viewer.EnableGroupTree = False
    frmReport.Show
End Sub



Public Sub mostrarReporteComparativo(bParms As BParametrosReporte)
    Dim i As Integer
    Set crReport = crApp.OpenReport(App.Path & "\reports\rptComparativo.rpt", 1)
    For i = 1 To crReport.ParameterFields.Count
        crReport.ParameterFields(i).ClearCurrentValueAndRange
    Next
    i = 1
    'crReport.ParameterFields(i).AddCurrentValue UCase(bParametro.bCompaniadPorDefecto.sRazonSocial): i = i + 1
    crReport.ParameterFields(i).AddCurrentValue "'" + Format(bParms.dFechaFin, bParametro.sFormatoFecha) + "'": i = i + 1
    crReport.ParameterFields(i).AddCurrentValue "'" + Format(bParms.dFechaIni, bParametro.sFormatoFecha) + "'": i = i + 1
    crReport.ParameterFields(i).AddCurrentValue "'" + bParametro.bCompaniadPorDefecto.sRuc + "'": i = i + 1
    crReport.ParameterFields(i).AddCurrentValue "'" + bParms.bPuntoVenta.sSerie + "'": i = i + 1
    For i = 1 To crReport.Database.Tables.Count
        crReport.Database.Tables(i).ConnectionProperties.Item("Password") = utilConexion.sClave
    Next i
    frmReport.viewer.ReportSource = crReport
    frmReport.viewer.ViewReport
    frmReport.viewer.EnableRefreshButton = False
    frmReport.viewer.EnableGroupTree = False
    frmReport.Show
End Sub
